#include "ros/ros.h"
#include "geometry_msgs/Twist.h"
#include <string>
#include "turtlesim/Pose.h"
void poseCallback(const turtlesim::PoseConstPtr& msg)
{
    ROS_INFO("x:%.2f,y:%.2f",msg->x,msg->y);
}
int main(int argc,char **argv)
{
    const double FORWARD_SPEED_MPS = 0.5;
    ros::init(argc,argv,"move_turtle");
    ros::NodeHandle node;
    ros::Publisher pub = node.advertise<geometry_msgs::Twist>("turtle1/cmd_vel", 10);
    std::string str = argv[1];
    ros::Subscriber sub = node.subscribe(str +"/pose", 10, poseCallback);
    geometry_msgs::Twist msg;
    msg.linear.x = 0.5;
    ros::Rate rate(10);
    ROS_INFO("Starting to mo ve forward");
    while(ros::ok())
    {
        pub.publish(msg);
        ros::spinOnce();
        rate.sleep();
    }
    return 0;
}